import { connect, Dispatch } from 'umi';
import { ConnectState } from '@/pages/demo/models/connect';

import GC from '../page';
const mapStateToProps = ({ demoFormRenderStore }: ConnectState) => ({
  ...demoFormRenderStore,
});

const mapDispatchToProps = (dispatch: Dispatch) => ({
  /**
   * 组件数据变化回调
   * @param schema
   */
  onSchemaChange: (schema: any) => {
    dispatch({
      type: 'demoFormRenderStore/setSchemaData',
      payload: schema,
    });
  },
  /**
   * 编辑数据源
   */
  editClick: () => dispatch({ type: 'demoFormRenderStore/setActiveKey', payload: 'data' }),
});

export default connect(mapStateToProps, mapDispatchToProps)(GC);
